/***
 * 测试代码 不同时间复杂度 1s内可以处理的大概n的规模
*/

#include <iostream>
#include <chrono>

using namespace std;
using namespace std::chrono;

// O(n)
void func1(long long n) {
    cout << "O(n): n = " << n  << endl;
    long long k = 0;
    for (long long i = 0; i < n; i++) {
        k++;
    }
    cout << "k: " << k << endl;
}

// O(n^2)
void func2(long long n) {
    cout << "O(n^2): n = " << n  << endl;
    long long k = 0;
    for (long long i = 0; i < n; i++) {
        for (long long j = 0; j < n; j++) {
            k++;
        }
    }
}

// O(nlogn)
void func3(long long n) {
    cout << "O(nlogn): n = " << n  << endl;
    long long k = 0;
    for (long long i = 0; i < n; i++) {
        for (long long j = 1; j < n; j = j * 2) {
            k++;
        }
    }
}

int main() {
    long long n; // 数据规模

    while (1) {
        cout << "cin n: " << endl;
        cin >> n;

        auto startTime = high_resolution_clock::now();
        // func1(n);
        func2(n);
        // func3(n);
        auto endTime = high_resolution_clock::now();

        auto duration = duration_cast<milliseconds>(endTime - startTime);
        
        cout << "cost time: " << duration.count() << " ms" << endl;
    }
    
    system("pause");
    return 0;
}